module.exports = function ($scope, $state, $stateParams,$resource,$modal,FileUploader,toaster, $modalInstance, items, flag) {
  $scope.flag = flag;
  console.log($scope.flag);
  var url = '';
  $scope.info = {
    'title' : ''
  }
  var para = {};
  var paras = {};
  $scope.cancel = function(){
    $modalInstance.close();
  }
  $scope.ok = function(){
    if(flag == 'sjcstg'){ // 市级初审通过
    url = '/api/as/ggc/reviewCityResponsible/updateAdopt';
      para = {
        'view_reason' : $scope.info.title,
        'money' : $scope.info.money * 100,
        'project_code' : items.project_code
      }
      paras = {
        'project_code' : items.project_code,
        'recommend_type' : items.recommend_type,
        'check_message' : $scope.info.title,
        'check_state' : '1'
      }
    } else if(flag == 'sjfhtg'){ // 市级复核通过
      url = '/api/as/ggc/reviewPlanning/updateAdopt';
      para = {
        'plan_reason' : $scope.info.title,
        'plan_money' : $scope.info.money * 100,
        'project_code' : items.project_code
      }
      paras = {
        'project_code' : items.project_code,
        'recommend_type' : '15',
        'check_message' : $scope.info.title,
        'check_state' : '1'
      }
    } else if(flag == 'zrcsfhtg'){ // 区县复核通过(责任处室)
      url = '/api/as/ggc/reviewCityResponsible/updateAdopt';
      para = {
        'view_reason' : $scope.info.title,
        'money' : $scope.info.money * 100,
        'project_code' : items.project_code
      }
      paras = {
        'project_code' : items.project_code,
        'recommend_type' : items.recommend_type,
        'check_message' : $scope.info.title,
        'check_state' : '1'
      }
    } else if(flag == 'ghcfhtg'){ // 区县复核通过(规划处)
      url = '/api/as/ggc/reviewPlanning/updateAdopt';
      para = {
        'plan_reason' : $scope.info.title,
        'plan_money' : $scope.info.money * 100,
        'project_code' : items.project_code
      }
      paras = {
        'project_code' : items.project_code,
        'recommend_type' : '15',
        'check_message' : $scope.info.title,
        'check_state' : '1'
      }
    }
    console.log(para);
    $resource(url, {}, {}).save(para, function(res){
        if(res.errcode != 0){   
            toaster.error({title:"",body:res.errmsg});
            return;
        }
        toaster.success({title:"",body:'操作成功'});
          $modalInstance.close();
    });
    $resource('/api/as/ggc/reviewPlanning/insertReviewCompanyProjectLog', {}, {}).save(paras, function(res){
      if(res.errcode != 0){   
          toaster.error({title:"",body:res.errmsg});
          return;
      }
      $modalInstance.close();
  });
  }
}  